<template>
    <div v-html="payPageHtml"></div>
</template>

<script setup>
import { onMounted } from 'vue';
import { ref } from 'vue';
import { useRoute } from 'vue-router';
import { default as http, getImageUrl } from '@/utils/request.js';
import { nextTick } from 'vue';
const route = useRoute();
const payPageHtml = ref('');
const orderNumber = ref(0);
orderNumber.value = route.params.orderNumber;

// 去支付
const payOrder = () => {
      http.get("/user/order/pay/"+orderNumber.value)
        .then((res) => {
          console.log('返回支付页面：', res);
          if (res.status === 200) {	//修改成功
            payPageHtml.value = res.data;
            nextTick(() => {
                document.forms[0].submit();
            })
          }
        }).catch((err) => {
          console.log('支付失败：', err);
        });
}


onMounted(() => {
    payOrder();
});

</script>